sequence = input('Введите скобучную последовательность: ')
stack = []

for char in sequence:
    if char in '([{':
        stack.append(char)
    else:
        if not stack:
            print('False')
            break
        elif char == ']' and stack.pop() != '[':
            print('False')
            break
        elif char == '}' and stack.pop() != '{':
            print('False')
            break
        elif char == ')' and stack.pop() != '(':
            print('False')
            break

else:
    if not stack:
        print('True')
    else:
        print('False')

